#include "stdafx.h"
#include "iostream"
#include "conio.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
//moshakhas konanndeye meghdare poshte
#define size 20
char stack[size];
int top=0,ele;
void push();
char pop();
int isempty();
int isfull();
char infix[30],PostFix[30];
int prec(char);
//tabea baraye gharar dadane amalgar dar poshte
void push(int ele)
{
stack[top]=ele;
top++;
}
//method baraye baddashtan az poshte
char pop()
{
top--;
return(stack[top]);
}
//method baraye moshakhkhas kardane olaviyate amalgarha
int prec(char symbol)
{
if(symbol== '(')
return 0;
if(symbol== ')')
return 0;
if(symbol=='+' || symbol=='-')
return 1;
if(symbol=='*' || symbol=='/')
return 2;
if(symbol=='^')
return 3;
return 0;
}
void main()
{
int i=0,j=0,k=0,length;
char temp;
printf(" Enter an infix expression:");
scanf("%s",infix);
length=strlen(infix);
for(i=0;i
نظرات شما عزیزان:
|